package com.dmx.fw.bean.mapping.pojo;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.CollectionOfElements;

/**
 * Organization generated by MyEclipse - Hibernate Tools
 */
@Entity
@Table(name = "SYSTEM_ORG")
public class Organization implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5469766113848125769L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO,generator="org_seq_gen")
	@SequenceGenerator(name = "org_seq_gen", sequenceName = "SEQ_OPTR")
	@Column(name = "ID", precision = 12, scale = 0)
	private Long orgId;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "LAST_UPDATED_TIME")
	private Date lastUpdatedTime;
	
	@Column(name="NAME",length=60)
	private String name;
	
	@Column(name="PAR_ORG_ID",precision=12,scale=0)
	private Long parOrgId;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PAR_ORG_ID",insertable=false,updatable=false)
	private Organization parentOrganization;
	
	@Column(name="STATUS",length=60)
	private String status;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="CREATED_BY",insertable=false,updatable=false)
	private Operator createdOperator;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "CREATED_TIME")
	private Date createdTime;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="LAST_UPDATED_BY",insertable=false,updatable=false)
	private Operator lastUpdatedOperator;
	
	@OneToMany(fetch=FetchType.LAZY)
	@CollectionOfElements
	@JoinColumn(name="ORG_ID")
	private Set<Operator> operators = new HashSet<Operator>(0);

	// Constructors

	/** default constructor */
	public Organization() {
	}

	/** full constructor */
	public Organization(String name, Long parOrgId,
			Organization parentOrganization, String status,
			Operator createdOperator, Date createdTime,
			Operator lastUpdatedOperator, Set operators) {
		this.name = name;
		this.parOrgId = parOrgId;
		this.parentOrganization = parentOrganization;
		this.status = status;
		this.createdOperator = createdOperator;
		this.createdTime = createdTime;
		this.lastUpdatedOperator = lastUpdatedOperator;
		this.operators = operators;
	}

	// Property accessors

	public Long getOrgId() {
		return this.orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}

	public Date getLastUpdatedTime() {
		return this.lastUpdatedTime;
	}

	public void setLastUpdatedTime(Date lastUpdatedTime) {
		this.lastUpdatedTime = lastUpdatedTime;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getParOrgId() {
		return this.parOrgId;
	}

	public void setParOrgId(Long parOrgId) {
		this.parOrgId = parOrgId;
	}

	public Organization getParentOrganization() {
		return this.parentOrganization;
	}

	public void setParentOrganization(Organization parentOrganization) {
		this.parentOrganization = parentOrganization;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Operator getCreatedOperator() {
		return this.createdOperator;
	}

	public void setCreatedOperator(Operator createdOperator) {
		this.createdOperator = createdOperator;
	}

	public Date getCreatedTime() {
		return this.createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Operator getLastUpdatedOperator() {
		return this.lastUpdatedOperator;
	}

	public void setLastUpdatedOperator(Operator lastUpdatedOperator) {
		this.lastUpdatedOperator = lastUpdatedOperator;
	}

	public Set getOperators() {
		return this.operators;
	}

	public void setOperators(Set operators) {
		this.operators = operators;
	}

}